<?php
header("Content-type:text/html; charset=utf-8");
require_once ('config.php');
require_once (WEBURL.'/include/conn.php');
require_once (WEBURL.'/login_status_check.php');

if(!checkLogin()){
	if(isset($_GET['pre_id'])){
		$pre_id=$_GET['pre_id'];
		$gotopage=base64_encode("channel_add.php?pre_id=$pre_id");
	}else{
		$gotopage=base64_encode("channel_add.php");
	}
	header("Location:admin_login.php?gotopage=".$gotopage);
}
else{
	require_once (WEBURL.'/channel.class.php');
	require_once (WEBURL.'/system.class.php');
	$pre_id=-1;
	if(isset($_GET['pre_id'])){
		$pre_id=$_GET['pre_id'];
	}
	$_SESSION['allowed_select_model']="allowed";
	$smarty->assign("title","添加栏目");
	$system=new System();
	$sys_style=$system->getSysStyle();
	$smarty->assign("sys_style",$sys_style);
	$channel=new Channel();
	$all_channel=$channel->getAllChannel("channel");
	$all_article_channel=$channel->getAllChannel("article");
	$smarty->assign("all_channel",$all_channel);
	$smarty->assign("all_article_channel",$all_article_channel);
	$smarty->assign("pre_id",$pre_id);
	$smarty->display("channel_add.htm",md5("channel_add.php?pre_id=$pre_id"));
}